package br.com.lis;

import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MyAdapter extends BaseAdapter{
	private Context context;
	private List<String> list;
	int[] images= {R.drawable.ic_menu_home, R.drawable.ic_menu_myplaces, R.drawable.ic_menu_add,R.drawable.ic_menu_delete, R.drawable.ic_menu_back, };
	
	public MyAdapter(Context context, List<String> list){
		this.context = context;
		this.list = list;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View row = null;
		if(convertView == null){
			LayoutInflater inflater = (LayoutInflater)context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
			row = inflater.inflate(R.layout.layout_my_adapter_drawer_home, parent, false);
		}
		else {
			row = convertView;		
		}
		
		/*TextView tv = new TextView(context);
		tv.setText(list.get(position));
		tv.setTextColor(Color.WHITE);
		tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,24);
		return tv;*/
		TextView titleTextview = (TextView) row.findViewById(R.id.tvLDrawerHome);
		ImageView titleImageview = (ImageView) row.findViewById(R.id.ivLDrawerHome);
		titleTextview.setText(list.get(position));
		titleImageview.setImageResource(images[position]);
	
		return row;
	}
	
}


